<template>
  <div>
    <div v-if="cart.length > 0">
      <CartItem
        v-for="item in cart"
        :key="item.id"
        :url="item.url"
        :count="item.count"
        :id="item.id"
        :title="item.title"
        :changeCount="changeCartCountByIdAndType"
      ></CartItem>
    </div>
  </div>
</template>

<script>
import CartItem from '@/components/CartItem';
import { mapState, mapMutations } from 'vuex';

export default {
  name: 'cart',
  components: {
    CartItem,
  },
  computed: {
    ...mapState(['cart']),
  },
  methods: {
    ...mapMutations(['changeCartCountByIdAndType']),
  },
};
</script>

<style>

</style>
